

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>love</title>
    <link href="favicon.ico" rel="shortcut icon" />
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
</head>
<body style=" background: url(http://global.bing.com/az/hprichbg/rb/RavenWolf_EN-US4433795745_1920x1080.jpg) no-repeat center center fixed; background-size: 100%;">


<div class="modal-dialog" style="margin-top: 10%;">
    <div class="modal-content">
        <div class="modal-header">

            <h4 class="modal-title text-center" id="myModalLabel">登录</h4>
        </div>
        <div class="modal-body" id = "model-body">
            <div class="form-group">

                <input type="text" id="user" class="form-control"placeholder="用户名" autocomplete="off">
            </div>
            <div class="form-group">

                <input type="password" id="pwd" class="form-control" placeholder="密码" autocomplete="off">
            </div>
        </div>
        <div class="modal-footer">
            <div class="form-group">
                <button type="button" onclick="login()" class="btn btn-primary form-control">登录</button>
            </div>

        </div>
    </div><!-- /.modal-content -->
</div><!-- /.modal -->
<script>
    function login() {
        $.ajax({
           url:"login",
            type:"POST",
            data:{"name":$("#user").val(),"pwd":$("#pwd").val()},
            success:function (data) {
                if (data){
                    window.location.href ="/index";
                }else {
                    alert('请输入用户 admin 密码 admin');
                }

            }
        });
    }
</script>

</body>
</html>